/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package CapadeDatos;


import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JOptionPane;
import modelo.beancarrera;

/**
 *
 * @author jxtx
 */
public class daocarrera2 {
public static List<beancarrera> listaItem1()   {
       Connection conexion=null;
        int I;
       try {
        //Connection cn = ConexionBD.getInstance().getConnection();
        //Statement stm = cn.createStatement();
        conexion=ConexionBD.getInstance().getConnection();
        String sql="call proc_carreras()";
        Statement st=conexion.createStatement();
        ResultSet rs=st.executeQuery(sql);
        //List<beanmodulo> oListItem=new ArrayList<beanmodulo>();
           ArrayList lista = new ArrayList();
       while(rs.next())
            {
               beancarrera modulo=new beancarrera();
               modulo.setNombrecarrera(rs.getString(1));
               modulo.setCodigo(rs.getString(2));
               lista.add(modulo);
            }
        return lista;
       }
       catch(Exception ex)
       {
           ex.printStackTrace();
           return null;
       }
       finally
       {
            try
            {
            conexion.close();
            }
            catch (SQLException ex)
            {
              ex.printStackTrace();
            }
       }
   }
}
